package a_singleinstance;

public class MainTest {

    public static void main(String[] args) {
        //通过 静态内部类实现的单例
        Singleton singleton1 = Singleton.getInstance();
        Singleton singleton2 = Singleton.getInstance() ;
        System.out.println(singleton1==singleton2);
        System.out.println("=========================================");
        //通过枚举
        SingletonEnum singletonEnum = SingletonEnum.INSTANCE ;
        SingletonEnum singletonEnum2 = SingletonEnum.INSTANCE ;

        System.out.println(singletonEnum==singletonEnum2);
    }
}
